package com.kaiwukj.android.ufamily.utils

import android.content.Context
import android.widget.ImageView
import com.blankj.utilcode.util.LogUtils
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.kaiwukj.android.mcas.utils.McaUtils
import com.kaiwukj.android.ufamily.mvp.ui.widget.CornerTransform
import com.youth.banner.loader.ImageLoader

/**
 * @author Haife Android Developer
 * @company KW | 开物
 * @since 2019-07-16
 * banner image loader
 */
class BannerImageLoader : ImageLoader() {
    override fun displayImage(context: Context?, path: Any?, imageView: ImageView?) {
        LogUtils.d("url-------------------->$path")
        if (imageView != null) {
            val cornerTransform = CornerTransform(context!!.applicationContext,
                    McaUtils.dip2px(context, 10.0f).toFloat())

            /* GlideArms.with(context!!.applicationContext)
                     .load(path)
                     //.skipMemoryCache(true)
                     .centerCrop()
                     .diskCacheStrategy(DiskCacheStrategy.ALL)
                     .transform(cornerTransform)
                     //.transform(RoundedCorners(SizeUtils.dp2px(10.0f)))
                     .into(imageView)*/

            Glide.with(context)
                    .load(path)
                    .centerCrop()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .transform(cornerTransform)
                    .into(imageView)
        }

    }

}
